public class Ex8_2{
	public static void main(String[] args){
		Stock s = new Stock("JAVA", "Sun Microsystems Inc");
		s.previousClosingPrice = 4.5;
		s.currentPrice = 4.35;
		System.out.printf("The price-change percentage: %.2f\n", 
			s.getChangePercent());
	}
}

class Stock{
	String symbol;
	String name;
	double previousClosingPrice;
	double currentPrice;

	Stock(String s, String n){
		symbol = s;
		name = n;
	}

	double getChangePercent(){
		return (currentPrice - previousClosingPrice) / 
			previousClosingPrice;
	}
}